package cn.edu.ujn.shi.service;

import cn.edu.ujn.shi.dao.DingdanMapper;
import cn.edu.ujn.shi.dao.Dingdan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DingdanServiceImpl implements IDingdanService {
    @Autowired
    private DingdanMapper dingdanMapper;

    @Override
    public List<Dingdan> getAll() {
        return dingdanMapper.getAll();
    }

    @Override
    public List<Dingdan> getMyDingdan(String username) {
        return dingdanMapper.getMyDingdan(username);
    }

    @Override
    public List<Dingdan> getMyDingdanLike(String username) {
        if (username == null) {
            username = "";
        }
        return dingdanMapper.getMyDingdanLike(username);
    }

    @Override
    public void insert(Dingdan dingdan) {
        dingdanMapper.insert(dingdan);
    }

    @Override
    public void delete(int did) {
        dingdanMapper.delete(did);
    }
}
